#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_light_clicked()
{
    //首先设置整个控件的颜色
    this->setStyleSheet("background-color: rgb(240, 240, 240);");
    //设置文本
    ui->textEdit->setStyleSheet("background-color: white; color: black;");  //这里背景是黑色，字体是白色
    //设置按钮
    ui->pushButton_light->setStyleSheet("background-color: white; color: black;");
    ui->pushButton_dark->setStyleSheet("background-color: white; color: black;");
}

void Widget::on_pushButton_dark_clicked()
{
    //首先设置整个控件的颜色
    this->setStyleSheet("background-color: black;");
    //设置文本
    ui->textEdit->setStyleSheet("background-color: black; color: white;");  //这里背景是白色，字体是黑色
    //设置按钮
    ui->pushButton_light->setStyleSheet("background-color: black; color: white;");
    ui->pushButton_dark->setStyleSheet("background-color: black; color: white;");
}
